]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
WorkspaceThumbnails: animate the right workspace when creating by DND
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sun, 16 Dec 2012 22:52:33 +0000 (23:52 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sun, 17 Mar 2013 18:35:15 +0000 (19:35 +0100)
To create a new workspace by dropping on the placeholder, we move all
the windows down one workspace and then wait for _checkWorkspaces() to
automatically create the empty one at the end.
This means that, from the implementation POV, the new workspace is not
the one created by DND but it's the last one, and this detail was exposed
in the UI because the animation was applied on that one.
Fix that by starting the animation manually from the DND code, and then
blocking the animation from happening when the new workspace is created
with a flag.

https://bugzilla.gnome.org/show_bug.cgi?id=685285

js/ui/workspaceThumbnail.js

index 4537b92c61caaeeac7ce81b686513244be33eb00..689ded0355390e651220df582613d6d5f2ed0319 100644 (file)
@@ -558,6 +558,7 @@ const ThumbnailsBox = new Lang.Class({
         this._dropPlaceholderPos = -1;
         this._dropPlaceholder = new St.Bin({ style_class: 'placeholder' });
         this.actor.add_actor(this._dropPlaceholder);
+        this._spliceIndex = -1;
 
         this._targetScale = 0;
         this._scale = 0;
@@ -740,6 +741,8 @@ const ThumbnailsBox = new Lang.Class({
                     return win.get_workspace() >= newWorkspaceIndex;
             });
 
+            this._spliceIndex = newWorkspaceIndex;
+
             // ... move them down one.
             windows.forEach(function(win) {
                 win.meta_window.change_workspace_by_index(win.get_workspace() + 1,
@@ -761,6 +764,14 @@ const ThumbnailsBox = new Lang.Class({
                                         WORKSPACE_KEEP_ALIVE_TIME);
             }
 
+            // Start the animation on the workspace (which is actually
+            // an old one which just became empty)
+            let thumbnail = this._thumbnails[newWorkspaceIndex];
+            this._setThumbnailState(thumbnail, ThumbnailState.NEW);
+            thumbnail.slidePosition = 1;
+
+            this._queueUpdateStates();
+
             return true;
         } else {
             return false;
@@ -848,7 +859,8 @@ const ThumbnailsBox = new Lang.Class({
             this._thumbnails.push(thumbnail);
             this.actor.add_actor(thumbnail.actor);
 
-            if (start > 0) { // not the initial fill
+            if (start > 0 && this._spliceIndex == -1) {
+                // not the initial fill, and not splicing via DND
                 thumbnail.state = ThumbnailState.NEW;
                 thumbnail.slidePosition = 1; // start slid out
                 this._haveNewThumbnails = true;
@@ -863,6 +875,9 @@ const ThumbnailsBox = new Lang.Class({
 
         // The thumbnails indicator actually needs to be on top of the thumbnails
         this._indicator.raise_top();
+
+        // Clear the splice index, we got the message
+        this._spliceIndex = -1;
     },
 
     removeThumbnails: function(start, count) {